<template>
	<view>
		<company-index :companyData="companyData"></company-index>
	</view>
</template>

<script>
	import {
		mapState,
		mapGetters
	} from 'vuex'
	import companyIndex from '@/components/companyIndex/companyIndex.vue'
	export default {
		components: {
			companyIndex
		},
		data() {
			return {
				companyData: {}
			}
		},
		onLoad(opt) {
			console.log(opt, 'opt');
			this.queryInfoByCardId(opt.id)
		},
		methods: {
			//通过分享人的cardId 查询
			async queryInfoByCardId(id) {
				let res = await this.$api.queryCartById({
					id
				})
				if (res.success && res.result) {
					if (!res.result.bcCompanyAbout) {
						this.companyData = {}
						this.companyData.swiperList = []
					} else {
						this.companyData = res.result.bcCompanyAbout || {}
						if (this.companyData.carousel.length > 0 && this.companyData.carousel && this.companyData
							.carousel != undefined) {
							if (this.companyData.carousel.indexOf(',') == -1) {
								this.companyData.swiperList = []
								this.companyData.swiperList.splice(0, 1, this.companyData.carousel)
							} else {
								let arr = this.companyData.carousel.split(",")
								this.companyData.swiperList = arr.map(item => {
									let newItem = {
										url: item,
										filePath: item
									}
									return newItem
								})
							}

						}
					}


				}

			},
		}
	}
</script>

<style>

</style>